#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "ActivityGroup.h"
#include "NamedElement.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class ActivityEdge;
class ActivityNode;
class Element;

/// <summary>
/// ActivityPartition
/// An ActivityPartition is a kind of ActivityGroup for identifying ActivityNodes
/// that have some characteristic in common.
/// </summary>
class UMLMODEL_EXPORT ActivityPartition : public NamedElement, public ActivityGroup {

public: // Constructors and destructors
    explicit ActivityPartition(const QString& umlType="uml::ActivityPartition");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// edges getter
    /// ActivityEdges immediately contained in the ActivityPartition.
    /// </summary>
    vector<shared_ptr<ActivityEdge>>& edges();

    /// <summary>
    /// isDimension getter
    /// Indicates whether the ActivityPartition groups other ActivityPartitions along a
    /// dimension.
    /// </summary>
    bool isDimension() const;

    /// <summary>
    /// isDimension setter
    /// Indicates whether the ActivityPartition groups other ActivityPartitions along a
    /// dimension.
    /// </summary>
    void setIsDimension(bool value);

    /// <summary>
    /// isExternal getter
    /// Indicates whether the ActivityPartition represents an entity to which the
    /// partitioning structure does not apply.
    /// </summary>
    bool isExternal() const;

    /// <summary>
    /// isExternal setter
    /// Indicates whether the ActivityPartition represents an entity to which the
    /// partitioning structure does not apply.
    /// </summary>
    void setIsExternal(bool value);

    /// <summary>
    /// nodes getter
    /// ActivityNodes immediately contained in the ActivityPartition.
    /// </summary>
    vector<shared_ptr<ActivityNode>>& nodes();

    /// <summary>
    /// represents getter
    /// An Element represented by the functionality modeled within the
    /// ActivityPartition.
    /// </summary>
    shared_ptr<Element> represents() const;

    /// <summary>
    /// represents setter
    /// An Element represented by the functionality modeled within the
    /// ActivityPartition.
    /// </summary>
    void setRepresents(shared_ptr<Element> value);

    /// <summary>
    /// subpartitions getter
    /// Other ActivityPartitions immediately contained in this ActivityPartition (as its
    /// subgroups).
    /// </summary>
    vector<shared_ptr<ActivityPartition>>& subpartitions();

    /// <summary>
    /// superPartition getter
    /// Other ActivityPartitions immediately containing this ActivityPartition (as its
    /// superGroups).
    /// </summary>
    shared_ptr<ActivityPartition> superPartition() const;

    /// <summary>
    /// superPartition setter
    /// Other ActivityPartitions immediately containing this ActivityPartition (as its
    /// superGroups).
    /// </summary>
    void setSuperPartition(shared_ptr<ActivityPartition> value);

private: // Fields
    /// <summary>
    /// edges
    /// ActivityEdges immediately contained in the ActivityPartition.
    /// </summary>
    vector<shared_ptr<ActivityEdge>> edges_;

    /// <summary>
    /// isDimension
    /// Indicates whether the ActivityPartition groups other ActivityPartitions along a
    /// dimension.
    /// </summary>
    const static bool isDimension_default_;
    bool isDimension_= isDimension_default_;

    /// <summary>
    /// isExternal
    /// Indicates whether the ActivityPartition represents an entity to which the
    /// partitioning structure does not apply.
    /// </summary>
    const static bool isExternal_default_;
    bool isExternal_= isExternal_default_;

    /// <summary>
    /// nodes
    /// ActivityNodes immediately contained in the ActivityPartition.
    /// </summary>
    vector<shared_ptr<ActivityNode>> nodes_;

    /// <summary>
    /// represents
    /// An Element represented by the functionality modeled within the
    /// ActivityPartition.
    /// </summary>
    shared_ptr<Element> represents_;

    /// <summary>
    /// subpartitions
    /// Other ActivityPartitions immediately contained in this ActivityPartition (as its
    /// subgroups).
    /// </summary>
    vector<shared_ptr<ActivityPartition>> subpartitions_;

    /// <summary>
    /// superPartition
    /// Other ActivityPartitions immediately containing this ActivityPartition (as its
    /// superGroups).
    /// </summary>
    shared_ptr<ActivityPartition> superPartition_;

};

} // namespace uml
